package com.tarena.csmall.front.web.service;

import cn.tedu.mall.common.restful.JsonPage;
import cn.tedu.mall.pojo.product.vo.SpuListItemVO;
import cn.tedu.mall.pojo.product.vo.SpuStandardVO;
import com.tarena.csmall.front.web.mapper.SpuMapper;
import com.tarena.csmall.front.web.repository.SpuRepository;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class SpuService {
    @Autowired
    private SpuRepository spuRepository;
    public JsonPage<SpuListItemVO> spuListByCatId(Long id) {
        //不做分页直接查所有
        List<SpuListItemVO> spuList= spuRepository.getSpus(id);
        return JsonPage.defaultPage(spuList);
    }

    public SpuStandardVO getSpu(Long spuId) {
        //UNDO 细致的考虑业务逻辑,比如spuId存在不存在对应spu数据
        return spuRepository.getSpu(spuId);
    }
}
